package org.vacoor.xqq.ui.dynamictree;

/**
 * User: Vacoor
 */
public class BuddyNode extends ShakeableNode<Buddy> {

    public BuddyNode(Buddy buddy) {
        super(buddy.getId());
        setData(buddy);
    }

    @Override
    public boolean isLeaf() {
        return true;
    }

    private static final int[] SHAKE_STATUS = new int[]{LEFT + BOTTOM, TOP, RIGHT + BOTTOM, TOP};
    private int shakeIdx;

    @Override
    protected int doNextShakeStatus() {
        if (shakeIdx > SHAKE_STATUS.length - 1) {
            shakeIdx = 0;
        }
        return SHAKE_STATUS[shakeIdx++];
    }

    @Override
    public String toString() {
        return userObject == null ?  "empty buddy node" : ((Buddy)userObject).getNick();
    }
}
